<div class="title-body-content"><?php echo $title_for_layout; ?></div>
<div class="wrapper-table clearfix">
    <table class="tbl-broking" border="1">
        <tr class="title-tbl" >
            <td class="td-inquirer"><?php echo $this->Paginator->sort('name', 'Contact Name'); ?></td>
            <td class="td-inquirer"><?php echo $this->Paginator->sort('country', 'Country Name'); ?></td>
            <td class="td-inquirer"><?php echo $this->Paginator->sort('contacttype_id', 'Contact Type Name'); ?></td>
            <td class="td-file-att"><?php echo $this->Paginator->sort('address'); ?></td>
            <td class="td-action"><?php echo __('Actions'); ?></td>
        </tr>
        <?php
            foreach ($aihcontacts AS $aihcontact) {
                $actions  = '<li>' . $this->Html->link(__('Edit'), array(
                        'controller' => 'aihcontacts',
                        'action' => 'edit',
                        $aihcontact['Aihcontact']['id'],
                    )) . '</li>';
                $actions .= ' ' . $this->Layout->adminRowActions($aihcontact['Aihcontact']['id']);
                if($aihcontact['Aihcontact']['lock'] <= 0) {
                    $actions .= ' <li><div class="space3">|</div>' . $this->Html->link(__('Delete'), array(
                        'controller' => 'aihcontacts',
                        'action' => 'delete',
                        $aihcontact['Aihcontact']['id'],
                        'token' => $this->params['_Token']['key'],
                    ), null, __('Are you sure you want to delete this Contact?')) . '</li>';
                } else {
                    $actions .= ' <li><div class="space3">|</div>Locked</li>';
                }
                echo '
                    <tr class="line-content-tbl" >
                        <td class="td-inquirer" style="text-align:left; padding-left:5px;">' . $aihcontact['Aihcontact']['name'] . '</td>
                        <td class="td-inquirer" style="text-align:left; padding-left:5px;">' . $aihcontact['Aihcontact']['country'] . '</td>
                        <td class="td-inquirer" style="text-align:left; padding-left:5px;">' . ($aihcontact['Contacttype']['name'] == null ? 'AIH' : $aihcontact['Contacttype']['name']) . '</td>
                        <td class="td-file-att" style="text-align:left; padding-left:5px;">' . $aihcontact['Aihcontact']['address'] . '</td>
                        <td class="td-action">
                            <ul>
                                ' . $actions . '
                            </ul>
                        </td>
                    </tr>';
            }
        ?>
    </table>
    <div class="wrapper-paging">
        <ul class="ul-paging">
            <?php echo $this->Paginator->numbers(array('tag'=>'li', 'separator' => '')); ?>
        </ul>
        <?php #echo $this->Paginator->counter(array('format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%'))); ?>
    </div>
    <div class="wrapper-button-form">
        <div class="button-form">
            <div class="button-aihre button-blue"><?php echo $this->Html->link(__('NEW'), array('action'=>'add')); ?></div>
        </div>
    </div>
</div>